package com.example.demo_0828.pojo.mapper;

import com.example.demo_0828.pojo.dto.AssignDTO;
import com.example.demo_0828.pojo.dto.PageQueryDTO;
import com.example.demo_0828.pojo.entity.WorkOrder;
import com.example.demo_0828.pojo.vo.WorkOrderVO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author Deng
 * @description 针对表【work_order】的数据库操作Mapper
 * @createDate 2024-08-28 13:12:10
 * @Entity com.example.demo_0828.pojo.entity.WorkOrder
 */
@Mapper
public interface WorkOrderMapper {
    /**
     * 批量删除
     *
     * @param ids
     * @return
     */
    int deleteByPrimaryKey(List<Integer> ids);

    /**
     * 添加
     *
     * @param record
     * @return
     */
    @Insert("insert into work_order(order_no, order_type, title, content, handle_dept_id, create_time, is_overdue)values (#{orderNo},#{orderType},#{title},#{content},#{handleDeptId},#{creatTime},#{fenpaiTime},#{isOverdue})")
    int insert(WorkOrder record);

    int insertSelective(WorkOrder record);

    WorkOrder selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(WorkOrder record);

    int updateByPrimaryKey(WorkOrder record);

    /**
     * 修改
     *
     * @param workOrder
     */
    void update(WorkOrder workOrder);

    /**
     * 分页查询
     *
     * @param pageQueryDTO
     * @return
     */
    @Select("select * from work_order")
    Page<WorkOrderVO> pageQuery(PageQueryDTO pageQueryDTO);

    /**
     * 分派
     *
     * @param assignDTO
     */
    @Update("update dept set dept_id = #{deptId},dept_name =#{deptName} ")
    void assign(AssignDTO assignDTO);

    void select1();

    void select2();
}
